package com.demo.apparel.mapper.uniapp;

import com.demo.apparel.entity.Agreement;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface WxAgreementMapper {

    @Select("SELECT * FROM agreement WHERE is_active=1 ORDER BY created_time DESC LIMIT 1")
    Agreement getActiveAgreement();

    @Select("SELECT * FROM agreement ORDER BY created_time DESC")
    List<Agreement> getAllAgreements();

    @Update("UPDATE agreement SET is_active=#{active}, updated_time=NOW() WHERE id=#{id}")
    int setActive(@Param("id") String id, @Param("active") boolean active);
}